package bat.iog.hytool.pattern.behavioral.observer.demo02;


public class ConcreteObserver implements Observer {
    private String name;
    private String observerState;
    private ConcreteSubject subject;
    
    public ConcreteObserver(ConcreteSubject subject, String name){
        this.subject = subject;
        this.name = name;
    }
    
    @Override
    public void Update() {
        observerState = subject.getSubjectStates();
        System.out.println(name+"状态是： " + observerState);
    }

    public ConcreteSubject getSubject() {
        return subject;
    }

    public void setSubject(ConcreteSubject subject) {
        this.subject = subject;
    }
}
